#include <stdio.h>
#include <stdlib.h>
#include "r5000_internal.h"
#include "r5k_vip_buttons.c"
#include "r5k_dish6000_buttons.c"

void show(unsigned char *data, int len) {
  int i,j;
  char c;
  int x = 0;
//  printf("\n");
//  for(i=7, j=5; i < len; i+=2) {
//    printf("%02x ", data[i]);
//  }
//  printf("\n");
  for(i=7, j=5; i < len; i+=2) {
    switch(data[i]) {
      case 0x3a: c = 'S'; break;
      case 0x1a: c = '0'; break;
      case 0x0e: c = '1'; break;
      default: c = 'U'; break;
    }
    printf("%c", c);
    if(i > 7 && i < 20) {
      if(c == '1')
        x |= 1 << j;
      j--;
    }
  }
  printf(": %d\n", x);
}

int main()
{
  int i;
  struct r5000_buttons *button_cmd = &vip_button_cmd;
  printf("0    : ");
  show(button_cmd->b0, button_cmd->len);
  printf("1    : ");
  show(button_cmd->b1, button_cmd->len);
  printf("2    : ");
  show(button_cmd->b2, button_cmd->len);
  printf("3    : ");
  show(button_cmd->b3, button_cmd->len);
  printf("4    : ");
  show(button_cmd->b4, button_cmd->len);
  printf("5    : ");
  show(button_cmd->b5, button_cmd->len);
  printf("6    : ");
  show(button_cmd->b6, button_cmd->len);
  printf("7    : ");
  show(button_cmd->b7, button_cmd->len);
  printf("8    : ");
  show(button_cmd->b8, button_cmd->len);
  printf("9    : ");
  show(button_cmd->b9, button_cmd->len);
  printf("clear: ");
  show(button_cmd->clear, button_cmd->len);
  printf("enter: ");
  show(button_cmd->enter, button_cmd->len);
  printf("power: ");
  show(button_cmd->power, button_cmd->len);
#if 1
  printf("p-on : ");
  show(button_cmd->power_on, button_cmd->len);
  printf("p-off: ");
  show(button_cmd->power_off, button_cmd->len);
#endif
} 
